<!doctype html>

<%@LANGUAGE="JScript" %>
<!--#include file ="Includes/JSON2.asp"-->
<!--#include file ="Includes/User.asp"-->
<!--#include file ="Includes/ASPHelpers.asp" namespace="Helpers"-->

<%
	var h = Helpers;
	var req = h.Req;

	var UserName = req("UserName", null);
	var redirect = req("redirect", "SearchFrameSet.asp");
	
	//User.Debug("response", "before:<br>");
    
    
    if(!h.IsDefined(UserName)){
		Response.Redirect("LoginScreen.asp");
    };

	UserName += "";
	UserName = Helpers.Trim(UserName);


    if(User.AllUsers.Contains(UserName)){
		%>
			<Script type="text/javascript">
				alert("That user name is currently already in use. Please choose another user name.");
				top.document.getElementById("main").src = "LoginScreen.asp";
			</script>
		<%
		Response.End();    
    }
    else{
	
		User.CurrentUser(UserName);
		User.AllUsers.Add(UserName);
		User.UserHistory.Add(UserName);
	    
		//User.Debug("response", "<br>after:<br>");

		%>

			<script type="text/javascript">
				var UserNameDisplay = top.document.getElementById("currentUser")
					.getElementsByTagName("p")[0];
				
				UserNameDisplay.innerHTML = "<%= UserName %>";

				window.location.replace("<%= redirect %>");
			</script>

		<%

   }

%>






<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CheckLogIn</title>
<link href="UniversalStyleSheet.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="490" border="0" align="center" cellpadding="0" cellspacing="0">
<caption class="TableTitles">Log In
</caption>
  <tr>
    <td width="20" height="20" background="Images/TableUpperLeft.png">&nbsp;</td>
    <td height="20" background="Images/TableUpperMiddle.png">&nbsp;</td>
    <td width="20" height="20" background="Images/TableUpperRight.png">&nbsp;</td>
  </tr>
  <tr>
    <td width="20" background="Images/TableMiddleLeft.png">&nbsp;</td>
    <td align="center" valign="middle" bgcolor="#FFFFFF"><p id="msg">Validating User Name...Please Wait </p></td>
    <td width="20" background="Images/TableMiddleRight.png">&nbsp;</td>
  </tr>
  <tr>
    <td width="20" height="20" background="Images/TableLowerLeft.png">&nbsp;</td>
    <td height="20" background="Images/TableLowerMiddle.png">&nbsp;</td>
    <td width="20" height="20" background="Images/TableLowerRight.png">&nbsp;</td>
  </tr>
</table>

</body>
</html>
